using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Net;
using System.Text;

namespace Microsoft.EPM.Events
{
    class EventEntry
    {
        #region Properties

        private EventLog eventLog;
        private EventLogEntryType entryType;
        private int eventID;
        private const string SOURCE = "EPM 2007 Timesheet Event";

        #endregion

        #region Constructor

        /// <summary>
        /// Default constructor
        /// </summary>
        public EventEntry()
        {
            entryType = EventLogEntryType.Error;
            eventID = 8989;
            eventLog = new EventLog();
            eventLog.Source = SOURCE;
        }

        #endregion

        #region Methods

        /// <summary>
        /// Write application event
        /// </summary>
        /// <param name="msg">Message</param>
        public void WriteEvent(string msg)
        {
            eventLog.WriteEntry(msg, entryType, eventID);
        }

        /// <summary>
        /// Write application event
        /// </summary>
        /// <param name="msg">Message</param>
        /// <param name="logEntryType">Log entry type</param>
        public void WriteEvent(string msg, EventLogEntryType logEntryType)
        {
            eventLog.WriteEntry(msg, logEntryType, eventID);
        }

        /// <summary>
        /// Write application event
        /// </summary>
        /// <param name="msg">Message</param>
        /// <param name="logEntryType">Log entry type</param>
        /// <param name="eventId">Event Id</param>
        public void WriteEvent(string msg, EventLogEntryType logEntryType, int eventId)
        {
            eventLog.WriteEntry(msg, logEntryType, eventId);
        }

        #endregion
    }
}
